package com.sheep.jucdemo.part1.part1_7;

/**
 * @Date 2022/4/6 22:14
 * @Created by sheep
 */
public class Test1_7_3 {

    public static void main(String[] args) throws InterruptedException {
        Thread threadOne = new Thread(new Runnable() {
            @Override
            public void run() {
                for (; ; ) {

                }
            }
        });
        // 启动子线程
        threadOne.start();
        // 设置中断标志
        threadOne.interrupt();
        // 获取中断标志
        System.out.println("isInterrupted:" + threadOne.isInterrupted());
        // 获取中断标志，并清除中断标志
        System.out.println("isInterrupted:" + threadOne.interrupted());
        // 获取中断标志，并清除中断标志
        System.out.println("isInterrupted:" + Thread.interrupted());
        // 获取中断标志
        System.out.println("isInterrupted:" + threadOne.isInterrupted());
        threadOne.join();
        System.out.println("main thread is over");
    }
}
